Map highlighting Boston’s boundaries, neighborhoods and surrounding hydrography
#importing neighborhoods, and hydrography data
neighborhoods <- readOGR("./Boston_Neighborhoods.geojson")
## OGR data source with driver: GeoJSON
## Source: "C:\Users\nikit\Documents\git\hw3-nikitas-new\Boston_Neighborhoods.geojson", layer: "Boston_Neighborhoods"
## with 26 features
## It has 7 fields
bos_311_subset <- read.csv("./Boston311_Subset.csv", header = TRUE, sep = ',')
early_vote_locations <- readOGR("./Early_Voting_Locations/Early_Voting_Locations.shp", layer = "Early_Voting_Locations")
## OGR data source with driver: ESRI Shapefile
## Source: "C:\Users\nikit\Documents\git\hw3-nikitas-new\Early_Voting_Locations\Early_Voting_Locations.shp", layer: "Early_Voting_Locations"
## with 28 features
## It has 20 fields
## Integer64 fields read as strings: OBJECTID District Zip Match_Scor Match_Id
hydro_line <- readOGR("./Hydrography_Line/Hydrography_Line.shp", layer = "Hydrography_Line", GDAL1_integer64_policy = TRUE)
## OGR data source with driver: ESRI Shapefile
## Source: "C:\Users\nikit\Documents\git\hw3-nikitas-new\Hydrography_Line\Hydrography_Line.shp", layer: "Hydrography_Line"
## with 1469 features
## It has 4 fields
## Integer64 fields read as doubles: OBJECTID
# Customized Palette
pal311 <- colorFactor(c("red", "green"), c("Closed", "Open"))
leaflet() %>%
setView(lng = -71.1241028, lat = 42.315407, zoom = 12) %>%
# Basemaps
addTiles(group = "OpenStreetMap.HOT") %>%
addProviderTiles("Esri.NatGeoWorldMap", group = "GeoWorldMap") %>%
addProviderTiles("CartoDB.DarkMatter", group = "DarkMatter") %>%
# Layers control
addLayersControl(
baseGroups = c("OpenStreetMap", "GeoWorldMap", "DarkMatter"),
options = layersControlOptions(collapsed = FALSE)
) %>%
# Adding polylines, polygons, points and legend
addPolylines(data = hydro_line, color = "blue") %>%
addPolygons(data = neighborhoods, color = "darkgreen", fill = FALSE) %>%
addCircleMarkers(data = bos_311_subset, lng = ~Longitude, lat = ~Latitude, radius = 1.2, color = ~pal311(CASE_STATUS)) %>%
addLegend(position = "bottomright" , pal = pal311, values = bos_311_subset$CASE_STATUS, title = "Manhole Status") %>%
addAwesomeMarkers(data = early_vote_locations,
lng = ~MatchLongi, lat = ~MatchLatit,
icon = makeAwesomeIcon(icon = "check", library = "fa", markerColor = "lightgray"), popup = ~Neighborho)